import config from '@/config';
import RequestBase from '@/utils/request.js';

const baseRequest = new RequestBase(config.equipment);
const baseRequestIot = new RequestBase(config.baseUrl);

//获取点检任务列表
export function getSubTaskList() {
  return baseRequest.get('/mobile/dfm/spot/getSubTaskList');
}

//获取点检任务详情
export function getSubTaskDetail(id) {
  return baseRequest.get(`/mobile/dfm/spot/executeView/${id}`);
}

//通过subTaskItemId查询场所数据
export function getAreaBySubTaskItemId(id) {
  return baseRequest.get(`/mobile/dfm/spot/itemView/${id}`);
}

//执行场所
export function executeItemAreaTask(data) {
  return baseRequest.post('/mobile/dfm/spot/executeItem', data);
}

//通过任务id查询设备点检数据
export function getDeviceBySubTaskItemId(id) {
  return baseRequest.get(`/mobile/dfm/spot/contentView/${id}`);
}

//执行设备部位
export function executeItemDeviceInfoTask(data) {
  return baseRequest.post('/mobile/dfm/spot/executeContent', data);
}

//获取点检标准
export function getPointInspectStandard(params) {
  return baseRequest.get(`/dfm/spot/standard/device/${params}`)
}

//获取点检记录
export function getPointInspectRecord(params) {
  return baseRequest.get(`/dfm/spot/record/device`, params)
}

//点选方式为dcs时，通过物联平台获取关联监测点位
export function getDevicePointByAttrCode(attrCode) {
  return baseRequestIot.get(`/iot/device/feign/v1/queryAttrShadow/${attrCode}`)
}